package net.lookyou.boot.demo.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import net.lookyou.boot.demo.entity.UserRole;
import net.lookyou.boot.demo.mapper.UserRoleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Gemerl
 */
@Service
public class UserRoleServiceImpl implements UserRoleService {

    @Autowired
    UserRoleMapper userRoleMapper;

    @Override
    public List<UserRole> queryUserList() {
        return userRoleMapper.queryUserList();
    }

    @Override
    public PageInfo<UserRole> queryUserRolePage(int page, int pageSize){
        //改写语句实现分页查询
        PageHelper.startPage(page, pageSize);
        List<UserRole> all = userRoleMapper.queryUserList();
        return new PageInfo<UserRole>(all);
    }

}